<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>写文章</title>
    <style type="text/css">
        .aligned {
            text-align: center;
            margin-top: 30px;
        }
    </style>
    <link type="text/css" rel="stylesheet" href="../static/css/semantic.min.css" th:href="@{/css/semantic.min.css}">
    <link type="text/css" rel="stylesheet" href="../static/lib/editorMd/css/editormd.min.css"
          th:href="@{/lib/editorMd/css/editormd.min.css}">
    <link type="text/css" rel="stylesheet" href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}">
    <link type="text/css" rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"
          th:href="@{https://unpkg.com/element-ui/lib/theme-chalk/index.css}">
    <link type="text/css" rel="stylesheet" href="../static/css/blogs.css" th:href="@{/css/blogs.css}">
    <link rel="stylesheet" href="../static/css/animate.css" th:href="@{/css/animate.css}">
</head>
<body>
<!-- 导航-->
<nav class="navbar navbar-default" role="navigation">
    <div class="container navigation-nav">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse"
                    data-target="#example-navbar-collapse">
                <span class="sr-only"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a th:href="@{/index}" id="logo" class="navbar-brand dd">流沙</a>
        </div>
        <div class="collapse navbar-collapse" id="example-navbar-collapse">
            <ul class="nav navbar-nav navbar-left">
                <li><a th:href="@{/index}" class="m-l-20"><i class="el-icon-reading"></i>&nbsp;<span
                        class="hidden-md hidden-sm">博文</span></a></li>
                <li><a th:href="@{/type}" class="m-l-20"><i class="el-icon-user"></i>&nbsp;<span
                        class="hidden-md hidden-sm">分类</span></a></li>
                <li><a th:href="@{/news}" class="m-l-20"><i class="el-icon-bell"></i>&nbsp;<span
                        class="hidden-md hidden-sm">消息</span></a></li>
            </ul>
            <form class="nav navbar-nav navbar-form search" method="post" role="search" action="#"
                  th:action="@{/search}"
                  target="_blank">
                <div class="form-group input-group">
                    <input type="text" name="query" class="form-control" placeholder="搜索"
                           th:value="${query}">
                </div>

            </form>
            <ul class="nav navbar-nav navbar-right">
                <!--<li>-->
                <a th:href="@{/login}" type="button" class="btn btn-link btn-lg btn-login"
                   th:style="${session.user}!=null ? 'display:none':'display:inline-block'">登录</a>
                <!--</li>-->
                <!--<li>-->
                <a th:href="@{/registered}" type="button" class="btn btn-danger btn-lg btn-register"
                   th:style="${session.user}!=null ? 'display:none':'display:inline-block'">注册</a>
                <!--</li>-->

                <li class="dropdown" th:style="${session.user}==null ? 'display:none':'display:inline-block'" id="drop">
                    <a href="#" class="dropdown-toggle bg clear" data-toggle="dropdown">
                        <img th:src="@{/images/timg.jpg}" class="img-circle" alt=""
                             style="width: 40px;height: 40px;">
                        <!--<span class="nickname" th:text="${session.user.nickname}"></span>-->
                        <i class="glyphicon glyphicon-triangle-right"></i>
                    </a>
                    <ul class="dropdown-menu animate__animated animate__fadeInRight">
                        <li style="height: 40px!important;">
                            <a th:href="@{/homepage}"><i class="glyphicon glyphicon-user"></i>&nbsp;&nbsp;&nbsp;个人主页</a>
                        </li>
                        <li style="height: 40px!important;">
                            <a th:href="@{/logout}"><i class="glyphicon glyphicon-log-out"></i>&nbsp;&nbsp;&nbsp;退出</a>
                        </li>
                    </ul>
                </li>
                <!--<li>-->
                <a th:href="@{/post}" type="button" class="btn btn-info btn-lg btn-edit"
                   th:style="${session.user}==null ? 'display:none':'display:inline-block'"><i
                        class="el-icon-edit"></i>写文章</a>
                <!--</li>-->
            </ul>
        </div>
    </div>
</nav>

<!--内容-->
<div class="">
    <div class="ui container">
        <form id="blog-form" action="#" th:object="${blog}" method="post"
              th:action="@{/post/admin/{list}/{article-management}}" class="ui form">
            <input type="hidden" name="published">
            <input type="hidden" name="blogId" id="blogId">
            <!--th:value="#{blogId}"-->
            <div class="required field">
                <div class="ui left labeled input">
                    <div class="ui selection compact dropdown label">
                        <input type="hidden" name="type.id">
                        <!--th:value="#{flag}"-->
                        <i class="dropdown icon"></i>
                        <div class="default text">分类</div>
                        <div class="menu">
                            <div th:each="type : ${type}" class="item" data-value="政治" th:data-value="${type.id}"
                                 th:text="${type.name}">政治
                            </div>
                        </div>
                    </div>
                    <input type="text" name="title" id="title" placeholder="标题">
                    <!--th:value="#{title}-->
                </div>
            </div>

            <div class="field">
                <div id="md-content" style="z-index: 1 !important;">
                    <textarea placeholder="博客内容" id="content" name="content" style="display: none"></textarea>
                    <!--th:text="#{content}"-->
                </div>
            </div>

            <div class="inline fields">
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="recommend" name="recommend" checked class="hidden">
                        <!--th:checked="#{recommend}"-->
                        <label for="recommend">推荐</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="shareStatement" name="shareStatement" class="hidden">
                        <!--th:checked="#{shareStatement}"-->
                        <label for="shareStatement">转载声明</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="appreciation" name="appreciation" class="hidden">
                        <!--th:checked="#{appreciation}"-->
                        <label for="appreciation">赞赏</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="commenttabled" name="commenttabled" class="hidden">
                        <!--th:checked="#{commenttabled}"-->
                        <label for="commenttabled">评论</label>
                    </div>
                </div>
            </div>

            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui label">首图</label>
                    <input type="text" id="firstpicture" name="firstpicture" placeholder="首图引用地址">
                    <!--th:value="#{firstpicture}"-->
                </div>
            </div>

            <div class="required field">
                <textarea name="description" id="description" placeholder="博客描述....." maxlength="200"></textarea>
            </div>

            <!--<div class="field">-->
            <!--<div class="ui success message" th:unless="${#strings.isEmpty(message)}">-->
            <!--<i class="close icon"></i>-->
            <!--<div class="header">提示：</div>-->
            <!--<p th:text="${message}">恭喜：发布成功！</p>-->
            <!--</div>-->
            <!--</div>-->

            <div class="ui right aligned container">
                <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                <button type="button" id="save-btn" class="ui button">保存</button>
                <button type="button" id="publish-btn" class="ui button">发布</button>
            </div>
        </form>
    </div>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>

<script type="text/javascript" src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript" src="../static/lib/editorMd/editormd.min.js"
        th:src="@{/lib/editorMd/editormd.min.js}"></script>
<script type="text/javascript" src="../static/lib/editorMd/lib/marked.min.js"
        th:src="@{/lib/editorMd/lib/marked.min.js}"></script>
<script type="text/javascript" src="../static/lib/editorMd/lib/prettify.min.js"
        th:src="@{/lib/editorMd/lib/prettify.min.js}"></script>
<script type="text/javascript" src="../static/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
<script type="text/javascript" src="../static/js/semantic.min.js" th:src="@{/js/semantic.min.js}"></script>
<script type="text/javascript" src="https://unpkg.com/element-ui/lib/index.js"
        th:src="@{https://unpkg.com/element-ui/lib/index.js}"></script>
<script type="text/javascript" src="../static/js/blogs.js" th:src="@{/js/blogs.js}"></script>
<script type="text/javascript">

    var contentEditor;

    contentEditor = editormd('md-content', {
        width: '100%',
        height: 640,
        syncScrolling: 'single',
        // path: '../static/lib/editorMd/lib/'
        path: '/lib/editorMd/lib/'
    });

    $('.ui .dropdown').dropdown({
        on: 'hover'
    });

    $('.message .close').on('click', function () {
        $(this).closest('.message').transition('fade');
    });

    $('#save-btn').click(function () {
        $("[name='published']").val(false);
        $('#blog-form').submit();
    });

    $('#publish-btn').click(function () {
        $("[name='published']").val(true);
        $('#blog-form').submit();
    });


</script>
</body>
</html>
